<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

function send_email($sender,$recipient,$reply='',$subject='', $message='')
{
    require_once("phpmailer/class.phpmailer.php");
    $mailer = new PHPMailer();

    $mailer->IsSMTP(); 
    $mailer->CharSet="utf-8"; 

    $mailer->Port = 25; 
    $mailer->SMTPAuth = true;
	//$mail->SMTPSecure = 'ssl';
    $mailer->Host ='ngoinhabeyeu.com'; 
    $mailer->Username = 'no-reply@ngoinhabeyeu.com'; 
    $mailer->Password = 'Z$J){bESkTzl'; 

    $mailer->FromName = 'ngoinhabeyeu.com'; 
    $mailer->From = $sender;

    $mailer->AddAddress($recipient); //mail nguoi nhan
    if($reply!='')
        $mailer->AddReplyTo($reply,"Contact ngoinhabeyeu.com");

    $mailer->Subject = $subject;
    $mailer->IsHTML(true); 
    $mailer->Body = $message;

    if(!$mailer->Send())
    {
        return false;
       echo "Loi: " . $mailer->ErrorInfo;
    }else{
        return true;
       echo "Gui thu thanh cong";
    }
	
}
?>